using SG.Lang.Dry.Base;
using SG.Lang.Dry.Controlling;
using SG.Lang.Dry.Mirrors;

namespace SG.Lang.Dry.Code
{
    public class Namespace : Element
    {
        private readonly string _name;

        private readonly Namespace _parent;

        private Namespace(ref ElementRecord elementRecord, ref NamespaceRecord namespaceRecord)
            : base(ref elementRecord)
        {
            _name = namespaceRecord.Name;
            _parent = namespaceRecord.Parent.ResolveNamespace();
        }

        public string Name { get { return _name; } }

        public Namespace Parent { get { return _parent; } }

        public static Namespace Create(ref ElementRecord elementRecord, ref NamespaceRecord namespaceRecord)
        {
            return new Namespace(ref elementRecord, ref namespaceRecord);
        }
    }
}